﻿var caseXzId = getParam("id");
$(function () {
    loadTables(caseXzId);

    //取消弹出对话框
    $('#dialogs').on('click', '.weui-dialog__btn_default', function () {
        $(this).parents('.js_dialog').fadeOut(200);
    });
    //跳出提示对话框
    $("#AddDialogs").click(function () {
        var $androidDialog1 = $('#androidDialog1');
        $androidDialog1.fadeIn(200);
    });
  
});

function loadTables(caseXzId) {   
    $.ajax({
        type: "GET",
        url: "/XSXXInfo/GetById?id=" + caseXzId + "&_t=" + new Date().getTime(),
        success: function (data) {
            if (data.title)
                $("#CaseName").append(data.title);
            if (data.caseTypeId)
                $("#CaseTitle1").append("类型：" + data.caseTypeId + "  发布时间：" + data.publicTime);
            if (data.summary)
                $("#Summary").append("&nbsp;&nbsp;&nbsp;&nbsp;" + data.summary);
            if (data.pics) {
                var picArray = data.pics.split("|");
                for (var item = 1; item < picArray.length; item++) {
                    $("#Pics").append("<img src='/UploadFiles/" + picArray[item] + "'>");
                }
            }
                //$("#Pics").html("");            
            if (data.reward)
                $("#Reward").append(data.reward);
            if (data.linkMan)
                $("#LinkMan").html(data.linkMan);
            if (data.linkTel)
                $("#LinkTel").html(data.linkTel);
            $("#AddClue").html("<a class='weui-dialog__btn weui-dialog__btn_default'>取消</a>" +
                "<a href='/XSXXInfo/XSXXClue?CaseId=" + data.id + "' class='weui-dialog__btn weui-dialog__btn_primary'>同意</a>");
        }
    })
};


//获取URL上的参数
function getParam(paramName) {
    paramValue = "";
    isFound = false;
    if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
        arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
        i = 0;
        while (i < arrSource.length && !isFound) {
            if (arrSource[i].indexOf("=") > 0) {
                if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
                    paramValue = arrSource[i].split("=")[1];
                    isFound = true;
                }
            }
            i++;
        }
    }
    return paramValue;
}